﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Collector
{
    public enum ViewParam
    {
        ID,
        ItemName,
        ItemInfo,
        LimitLow,
        TestValue,
        LimitHigh,
        TestUnit,
        ItemResult,
        
        ViewParam_Max
    }
    public enum CallBackInfo
    {
        TESTITEM,
        PROGRESS,
        TestResult,

        CallBackInfo_Max,
    }
    public class UIItemInfo
    {
        public string ItemName;
        public string info;
        public string LimitLow;
        public string TestValue;
        public string LimitHigh;
        public string TestUnit;
        public string ItemResult;

        public UIItemInfo()
        {
            ItemName = "-";
            info ="-";
            LimitLow = "-";
            TestValue = "-";
            LimitHigh = "-";
            TestUnit = "-";
            ItemResult = "-";
        }

        public string MakeString()
        {
            //return "ItemName:" + ItemName + " info:" + info + " LimitLow:" + LimitLow + " Value:" + TestValue + " LimitHigh:" + LimitHigh + " TestUnit:" + TestUnit + " ItemResult:" + ItemResult;
            return "ItemName:" + ItemName + " info:" + info + " LimitLow:" + LimitLow + " Value:" + TestValue + " LimitHigh:" + LimitHigh + " TestUnit:" + TestUnit + " ItemResult:" + ItemResult;
        }

    }
    public class ViewInfo
    {
        public string name;
        public ViewInfo(string ItemName)
        {
            name = ItemName;
        }
    }
    public class LogKeys
    {
        private static Dictionary<ViewParam, ViewInfo> InfoMap = new Dictionary<ViewParam, ViewInfo>();

        public static ViewInfo GetInfo(ViewParam index)
        {
            if (InfoMap.ContainsKey(index))
            {
                return InfoMap[index];
            }

            return null;
        }

        public static void Init()
        {
            InfoMap.Clear();
            
            //exe 回传数据时，关键字段的说明
            //InfoMap.Add(CallBackInfo.TESTITEM, new ViewInfo("$TESTITEM$"));   //测试项
            //InfoMap.Add(CallBackInfo.PROGRESS, new ViewInfo("$PROGRESS$"));   //进度条
            //InfoMap.Add(CallBackInfo.TestResult, new ViewInfo("$TESTRESULT$")); //总的测试结果

            //此处是测试项显示的名字
            InfoMap.Add(ViewParam.ID, new ViewInfo("No."));
            InfoMap.Add(ViewParam.ItemName, new ViewInfo("Test Item"));
            InfoMap.Add(ViewParam.ItemInfo, new ViewInfo("Test Info"));
            //InfoMap.Add(ViewParam.LimitLow, new ViewInfo("LimitLow"));
            InfoMap.Add(ViewParam.TestValue, new ViewInfo("TestValue"));
            //InfoMap.Add(ViewParam.LimitHigh, new ViewInfo("LimitHigh"));
            //InfoMap.Add(ViewParam.TestUnit, new ViewInfo("TestUnit"));
            InfoMap.Add(ViewParam.ItemResult, new ViewInfo("Result"));

        }
    }



}
